#Copyright (c) 2012 The cwkshell Authors. All rights reserved. 
# Use of this source code is governed by a BSD-style license that can be 
#found in the LICENSE file. 
#获取参数
my $path = $ARGV[0];
my @elments = split("/",$path);
my $el = pop @elments;
my @argv_temp = @ARGV;
shift @argv_temp;
my @files_names = @argv_temp;
#循环生成文件
foreach $files_name(@files_names)
{
	#generate .h file 
	my $path_tmp = $path;
	$path_tmp =~ s/..\/src\/cwkshell\///g;
	$path_tmp =~s/\//_/g;

	open FILE ,">".$path."/".$files_name.".h" or die("can not open files");
	print FILE "//Copyright (c) 2012-2013 The cwkshell Authors. All rights reserved. \n";
	print FILE	"// Use of this source code is governed by a BSD-style license that can be \n";
	print FILE	"// found in the LICENSE file. \n";
	print FILE	"#ifndef CUC_CWKSHELL_".uc($path_tmp)."_".uc($files_name)."_H_ \n";
	print FILE	"#define  CUC_CWKSHELL_".uc($path_tmp)."_".uc($files_name)."_H_ \n";

	
	print FILE	"namespace cuc{ \n";
	
	print FILE	"	namespace shell{ \n";

	print FILE	"	} //namespace shell \n";

	print FILE	"} //namespace cuc \n";

	print FILE	"#endif //CUC_CWKSHELL_".uc($path_tmp)."_".uc($files_name)."_H_ \n";
	
	close FILE;
	print $files_name.".h has been generated. \n";



	#generate .cc file 
	open CC_FILE ,">".$path."/".$files_name.".cc" or die("can not open files");
	print CC_FILE "//Copyright (c) 2012 The cwkshell Authors. All rights reserved. \n";
	print CC_FILE	"// Use of this source code is governed by a BSD-style license that can be \n";
	print CC_FILE	"// found in the LICENSE file. \n";
	my $path_tmp2 = $path;
	$path_tmp2 =~ s/\.\.\///g;
	print CC_FILE	'#include "cuc/'.$path_tmp2."/".$files_name.".h\" \n";
	

	
	print CC_FILE	"namespace cuc{ \n";
	
	print CC_FILE	"	namespace shell{ \n";

	print CC_FILE	"	} //namespace shell \n";

	print CC_FILE	"} //namespace cuc \n";

	
	
	close CC_FILE;
	print $files_name.".cc has been generated. \n";
}